﻿using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Data.AggregateRoots.Identity;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;

namespace Web.Identity.Core
{
    public class AppSignInManager : SignInManager<IdentityUser, Guid>
    {
        public AppSignInManager(AppUserManager userManager)
            : base(userManager, OwinContextHelper.CurrentOwinContext.Authentication)
        {

        }

        public override async Task<ClaimsIdentity> CreateUserIdentityAsync(IdentityUser user)
        {
            var userIdentity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
            return userIdentity;
        }
    }
}
